package cn.zh.npro.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import cn.zh.npro.Item.AcLItem;
import cn.zh.npro.R;
import cn.zh.npro.Util.ToastUtil;

public class ClinkMan extends BaseActivity {

    ImageView cmback;
    TextView compte;
    AcLItem acLItem=null;
    EditText ecname,ecwork,edphone,ceadre;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_clink_man);
        initcm();
       }

    public void initcm(){
        cmback=findViewById(R.id.cmback);
        compte=findViewById(R.id.compte);

        ecname=findViewById(R.id.ecname);
        ecwork=findViewById(R.id.ecwork);
        edphone=findViewById(R.id.edphone);
        ceadre=findViewById(R.id.ceadre);

        cmback.setOnClickListener(this);
        compte.setOnClickListener(this);
       }

    @Override
    public void onClick(View view) {
        super.onClick(view);
        int id=view.getId();
        switch (id){
            case R.id.cmback:
                finish();
                break;
            case R.id.compte:
                String nam=ecname.getText().toString();
                String job=ecwork.getText().toString();
                String phone=edphone.getText().toString();
                String adre=ceadre.getText().toString();
                if (nam.equals("")||job.equals("")||phone.equals("")||adre.equals("")){
                    ToastUtil.showLong(ClinkMan.this,"信息未填写完整");
                    return;
                  }
                acLItem=new AcLItem(nam,job,phone,adre,false,false);
                Intent intent =new Intent(ClinkMan.this,AcLink.class);
                intent.putExtra("Item",acLItem);
                setResult(1,intent);
                finish();
                break;
           }

       }
}
